<template>
	<view class="content">
		<nav-header bgColor="bg-custom-color" :isBack="true">
			<block slot="content">GHMI</block>
		</nav-header>


		<view class="cu-list menu card-menu margin-top wallet">
			<!-- <view class="cu-item ">
				<view class="content et-content">
					<text class="text-grey et-text lc1-1 bg-color">GHMI</text>
				</view>
			</view> -->
			<view class="lc2-son bg-color1">
				<view class="lc2-son1 lc2-son-par">
					<text class="lc2-son1-text">{{$t('balance')}}</text>
					<text class="lc2-son1-text">{{$t('freezing')}}</text>
					<text class="lc2-son1-text">{{$t('conversion')}}(USDT)</text>
				</view>
				<view class="lc2-son2 lc2-son-par">
					<text class="lc2-son2-text text-color">{{userInfo.biDianzi}}</text>
					<text class="lc2-son2-text text-color">{{orderMoneySum}}</text>
					<text class="lc2-son2-text text-color">{{$common.numFilter(orderMoneySum * bili) }}</text>
				</view>
			</view>
		</view>

		<view class="padding" style="display: flex;">
			<text class="bg-et thisBtn" @click="$common.toPage('../wallet/wallet_ghmi_from')">{{$t('wallet.recharge')}}</text>
			<!-- <text class="bg-et thisBtn" @click="$common.toPage('../wallet/wallet_ghmi_from')">转账</text> -->
			<text class="bg-et thisBtn" @click="$common.toPage('../order/record')">{{$t('index.lineUpOrderRecord')}}</text>
			<text class="bg-et thisBtn" @click="$common.toPage('../wallet/wallet_ghmi_record')">{{$t('wallet.ghmiRecord')}}</text>
		</view>

		<view class="cu-list menu card-menu wallet">
			<view class="lc2-son">
				<view class="lc2-son2 " v-for="(item,index) in list" style="padding: 10px;">
					<view class="lc2-son-par">
						<text class="lc2-son2-text text-color" style="text-align: left;">{{item.tradeIndex}}</text>
						<text class="lc2-son2-text text-color" style="text-align: right;">{{item.orderState == 10?$t('order.unfinished'):$t('order.completed')}}</text>
					</view>

					<view class="">
						<view class="cl2-son2-title"><text class="text-color "></text><text class="text-color">{{item.orderMoney}}USDT</text></view>
						<view class="cl2-son2-title"><text class="text-color">{{$t('order.returnMoney')}}:</text><text class="text-color">{{item.profitMoney?item.profitMoney:'0'}}USDT</text></view>
						<text class="cl2-son2-title text-color" style="text-align: left;">{{$common.dateFormat(item.addDate)}}</text>
					</view>
				</view>
			</view>
		</view>

	</view>


</template>

<script>
	var t
	export default {
		data() {
			return {
				list: [],
				userInfo: null,
				orderMoneySum: '0.00',
				zheheUsdt: '0.00',
				bili: 1,
			}
		},
		onLoad() {
			t = this;
			this.$i18n.locale = t.$common.localRead("local")
			t.userInfo = $common.getUser();
			console.info(t.userInfo.id)
			t.getData();
			t.getHuilv()
		},
		methods: {
			getData() {
				let data = {
					addUserId: t.userInfo.id,
					orderState: 10
				}
				t.$fetch.request('orderInfo/list', data).then((res) => {
					if (res.code == 200) {
						console.info("获取orderInfo/list成功")
						t.list = res.data.entityList
						// $common.setToken(res.data.token)
						// console.info($common.getToken())

						// t.getUserByToken()
					} else {
						$common.showToast(res.msg);
					}
				}).catch((e) => {})
			},
			getHuilv() {
				this.$fetch.request('api/queryExchange', {
					shortName: 'CNY'
				}).then((res) => {
					console.info(res.data)
					if (res.status == 'success') {
						t.bili = res.data.USDT
						console.info(t.bili)
					} else {
						$common.showToast(res.message);
					}
				}).catch((e) => {})
			},
		}
	}
</script>

<style>
	.cu-list.card-menu {
		overflow: hidden;
		margin-right: 0px;
		margin-left: 0px;
		border-radius: 0px;
	}

	.thisBtn {
		flex: 1;
		padding: 10px;
		text-align: center;
		margin: 0 15px;
		border-radius: 10px;
	}

	.wallet .cu-item:after {
		border-bottom: 0px solid #ddd;
	}

	.wallet .cu-item {
		background-color: #121E2E;
	}

	.lc2-son2 {
		margin: 10px;
		padding: 5px;
		background-color: #121E2E;
		border-radius: 6px;
	}

	.cl2-son2-title {
		line-height: 48upx;
		height: 48upx;
	}

	.lc2-son-par {
		display: flex;
		height: 30px;
		line-height: 30px;
	}

	.lc2-son1-text {
		color: #5C7392;
		flex: 1;
		text-align: center;
	}

	.lc2-son2-text {
		flex: 1;
		text-align: center;

	}
</style>
